package cn.jbolt.wechat.admin.user;

import cn.jbolt.core.base.JBoltMsg;
import cn.jbolt.core.para.JBoltValidator;
import cn.jbolt.core.util.JBoltArrayUtil;
import cn.jbolt.wechat.model.WechatMpinfo;
import cn.jbolt.wechat.service.JBoltWechatMpinfoService;
import cn.jbolt.wechat.service.JBoltWechatUserService;
import com.jfinal.aop.Inject;
import com.jfinal.core.Controller;

/**
 * 请求接口必须传入mpId
 *
 * @ClassName: WechatKeywordsMgrValidator
 * @author: JFinal学院-小木 QQ：909854136
 * @date: 2019年6月22日
 */
public class WechatUserArgValidator extends JBoltValidator {
    @Inject
    private JBoltWechatUserService wechatUserService;
    @Inject
    private JBoltWechatMpinfoService wechatMpinfoService;

    @Override
    protected void validate(Controller c) {
        validateJBoltLong(0, JBoltMsg.PARAM_ERROR + ":微信公众平台mpId");
        Long mpId = c.getLong(0);
        if (mpId != null && mpId > 0) {
            WechatMpinfo mpinfo = wechatMpinfoService.findById(mpId);
            if (mpinfo == null) {
                setErrorMsg("微信公众平台" + JBoltMsg.DATA_NOT_EXIST);
            }

        }
    }


}
